package com.csj.mvvm.api

import okhttp3.RequestBody
import okhttp3.ResponseBody
import retrofit2.http.*


interface ApiService {

    @GET
    suspend fun get(
        @Url path: String,
        @QueryMap params: Map<String, String?>
    ): ResponseBody


    @POST
    suspend fun post(
        @Url path: String,
        @QueryMap params: Map<String, String?>
    ): ResponseBody

    @POST
    @FormUrlEncoded
    suspend fun postForm(
        @Url path: String,
        @FieldMap params: Map<String, String?>
    ): ResponseBody

    @POST
    suspend fun json(
        @Url path: String,
        @Body requestBody: RequestBody?
    ): ResponseBody

    /**
     * 文件上传（可携带参数）
     */
    @POST
    suspend fun uploadFile(
        @Url path: String,
        @Body requestBody: RequestBody?
    ): ResponseBody
}